from django.conf.urls.defaults import *
import os

# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns('',
    # Example:
    # (r'^djangoprojects/', include('djangoprojects.foo.urls')),
    
    #root related
    (r'^cassaco/$', 'cassacoproject.cassaco.views.registrationView.index'),
    
    #settings related
    (r'^cassaco/settings$', 'cassacoproject.cassaco.views.settingsView.index'),
    
    #spents related
    (r'^cassaco/spent/new$', 'cassacoproject.cassaco.views.spentView.new'),
    
    (r'^cassaco/spent/edit/(?P<id>\d+)/', 
        'cassacoproject.cassaco.views.spentView.edit'),
        
    (r'^cassaco/spent/list/(?P<page>\d+)/$', 
        'cassacoproject.cassaco.views.spentView.list'),
        
    (r'^cassaco/spent/list/(?P<page>\d+)/(?P<date>(\d+-\d+-\d+))/$', 
            'cassacoproject.cassaco.views.spentView.listByDate'),
            
    (r'^cassaco/spent/list/(?P<page>\d+)/(?P<date>(\d+-\d+-\d+))/(?P<date2>(\d+-\d+-\d+))/$', 
            'cassacoproject.cassaco.views.spentView.listBetweenDate'),
            
    (r'^cassaco/spent/save$', 'cassacoproject.cassaco.views.spentView.save'),
    
    (r'^cassaco/spent/delete$', 'cassacoproject.cassaco.views.spentView.delete'),
    
    (r'^cassaco/spent/listByCategory/(?P<category_id>\d+)/(?P<page>\d+)', 
        'cassacoproject.cassaco.views.spentView.listByCategory'),
        
    (r'^cassaco/spent/listBySubcategory/(?P<subcategory_id>\d+)/(?P<page>\d+)', 
        'cassacoproject.cassaco.views.spentView.listBySubcategory'),
        
    (r'^cassaco/spent/listByCategory/(?P<category_id>\d+)', 
        'cassacoproject.cassaco.views.spentView.listByCategory', {'page': 1}),
        
    (r'^cassaco/spent/listBySubcategory/(?P<subcategory_id>\d+)', 
        'cassacoproject.cassaco.views.spentView.listBySubcategory', {'page': 1}),
    
    #category
    (r'^cassaco/category/delete/(?P<id>\d+)/', 
        'cassacoproject.cassaco.views.categoryView.delete'),
        
    (r'^cassaco/category/getHTMLSelect/$', 
        'cassacoproject.cassaco.views.categoryView.getHTMLSelect', {'id': 0}),
        
    (r'^cassaco/category/getHTMLSelect/(?P<id>\d+)', 
        'cassacoproject.cassaco.views.categoryView.getHTMLSelect'),
        
    (r'^cassaco/category/new', 
        'cassacoproject.cassaco.views.categoryView.new'),
    
    #subcategory
    (r'^cassaco/subcategory/delete/(?P<id>\d+)/', 
        'cassacoproject.cassaco.views.subcategoryView.delete'),
        
    (r'^cassaco/subcategory/getHTMLSelect/(?P<category_id>\d+)/$', 
        'cassacoproject.cassaco.views.subcategoryView.getHTMLSelect', {'id': 0}),
        
    (r'^cassaco/subcategory/getHTMLSelect/(?P<category_id>\d+)/(?P<id>\d+)', 
        'cassacoproject.cassaco.views.subcategoryView.getHTMLSelect'),
    
    (r'^cassaco/subcategory/new', 
    'cassacoproject.cassaco.views.subcategoryView.new'),
    
    #mode
    (r'^cassaco/mode/getHTMLSelect/$', 
        'cassacoproject.cassaco.views.modeView.getHTMLSelect', {'id': 0}),
        
    (r'^cassaco/mode/getHTMLSelect/(?P<id>\d+)', 
        'cassacoproject.cassaco.views.modeView.getHTMLSelect'),
    
    (r'^cassaco/mode/new', 
    'cassacoproject.cassaco.views.modeView.new'),
        
    #settingsView urls
    (r'^cassaco/export', 
        'cassacoproject.cassaco.views.settingsView.export'),
    (r'^cassaco/import', 
        'cassacoproject.cassaco.views.settingsView.import_'),
        
    #other
    (r'^cassaco/util/getCategoriesAndSubcategoriesHTML', 
        'cassacoproject.cassaco.views.util.getCategoriesAndSubcategoriesHTML'),
    
    # Uncomment the admin/doc line below and add 'django.contrib.admindocs' 
    # to INSTALLED_APPS to enable admin documentation:
    # (r'^admin/doc/', include('django.contrib.admindocs.urls')),
    
    #auth
   (r'^accounts/login/$', 'django.contrib.auth.views.login'),
   (r'^cassaco/logout/$', 'cassacoproject.cassaco.views.registrationView.logout'),

    # Uncomment the next line to enable the admin:
    (r'^admin/(.*)', admin.site.root),
    
    #media (static files)
    (r'^cassaco/media/(?P<path>.*)$', 'django.views.static.serve',
        {'document_root': os.path.join(os.getcwd(), 'media')}),

)
